app.service('shopWechatConfigService',['$q','utilService',function($q,utilService){
    var _this_=this;

    //查询店铺微信配置信息
    _this_.getWechatConfig= function ($scope) {
        var deferred = $q.defer();
        utilService.get({
            url:$scope.app.domain + 'shop/wechat/config'
        }).then(function(response){
            deferred.resolve(response.data);
        },function(e){
            console.error(e);
            deferred.reject("连接服务器出错！");
        })

        return deferred.promise;
    }

    _this_.updateWechatConfig = function($scope){
        console.info($scope.wechat)
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'shop/add/or/update',
            data:$scope.wechat,
            method:'POST'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    }

}]);